/**
 * 
 */
package net.sf.cldsql.dj.utl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Conv
 */
public class CollUtl {
    @SuppressWarnings("unchecked")
    public static Map toMap(Object... arr) {
        HashMap ret = new HashMap();
        if (arr.length % 2 == 0) {
            for (int i = 0; i < arr.length; i += 2) {
                ret.put(arr[i], arr[i + 1]);
            }
        } else {
            new DiException ("Invalid input parameters, odd number parameters need.");
        }
        return ret;
    }
    
    @SuppressWarnings("unchecked")
    public static List toList(Object... arr) {
        ArrayList ret = new ArrayList();
        for (int i = 0; i < arr.length; i ++) {
            ret.add(arr[i]);
        }
        return ret;
    }
}
